<?php echo $this->element('menu'); ?>
<div class="coevents index">
	<h2><?php __('Coevents');?></h2><?php echo $this->Html->link(__('Export to csv file', true), array('controller' => 'coevents', 'action' => 'export')); ?>&nbsp;&nbsp;<?php echo $this->Html->link(__('Upload csv file', true), array('controller' => 'coevents', 'action' => 'upload_csv')); ?><br><br>
	<table cellpadding="0" cellspacing="0">
	<tr>
			<th class="actions"><?php __('Actions');?></th>
			<th><?php echo $this->Paginator->sort('ComID','ComID');?></th>
			<th><?php echo $this->Paginator->sort('EventID');?></th>			
			<th><?php echo $this->Paginator->sort('Event');?></th>
			<th><?php echo $this->Paginator->sort('EventDate');?></th>
			<th><?php echo $this->Paginator->sort('Position');?></th>
			<th><?php echo $this->Paginator->sort('delistDate');?></th>
			<th><?php echo $this->Paginator->sort('Note');?></th>
						
	</tr>
	<?php
	$i = 0;
	foreach ($coevents as $coevent):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<td class="actions">
			<?php echo $this->Html->link(__('View', true), array('action' => 'view', $coevent['Coevent']['EventID'])); ?><br><br>
			<?php echo $this->Html->link(__('Edit', true), array('action' => 'edit', $coevent['Coevent']['EventID'])); ?><br><br>
			<?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $coevent['Coevent']['EventID']), null, sprintf(__('Are you sure you want to delete # %s?', true), $coevent['Coevent']['EventID'])); ?>
		</td>
		<td>
			<?php echo $this->Html->link($coevent['Codetail']['ComName'], array('controller' => 'codetails', 'action' => 'view', $coevent['Codetail']['ComID'])); ?>
		</td>
		<td><?php echo $coevent['Coevent']['EventID']; ?></td>
		<td><?php echo $this->Text->truncate($coevent['Coevent']['Event'],50,array('ending'=>'...','exact'=>false)); ?></td>
		<td><?php if($coevent['Coevent']['EventDate']!="0000-00-00 00:00:00") echo date("d/m/Y H:i",strtotime($coevent['Coevent']['EventDate'])); ?></td>
		<td><?php echo $coevent['Coevent']['Position']; ?></td>
		<td><?php echo $coevent['Coevent']['delistDate']; ?></td>
		<td><?php echo $coevent['Coevent']['Note']; ?></td>
		
		
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
</div>